package com.yyg.ssm.service.impl;

import com.yyg.ssm.domain.User;
import com.yyg.ssm.mapper.UserMapper;
import com.yyg.ssm.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import java.util.List;

/**
 * @Author: 一一哥
 * @Blame: yyg
 * @Since: Created in 2021/1/6
 * @Description: $cursor$
 */
@Component
public class UserSerivceImpl implements UserService {

    @Autowired
    private UserMapper userMapper;

    public User login(String username) {

        List<User> users = userMapper.findUserByName(username);

        if (users != null & users.size() > 0) {
            return users.get(0);
        }

        return null;
    }

    public List<String> selectRolesByUid(Integer id) {

        return userMapper.selectRolesByUid(id);
    }

    public List<String> selectPermissionsByUid(Integer id) {

        return userMapper.selectPermissionsByUid(id);
    }

}
